#include "TestApi.h"

static void DemoTimerPrint() {
	S_INFO("DemoTimerPrint, *************");
}


TestApi::TestApi()
{

}


void TestApi::Test00()
{
	if (!_demo_api) {
		S_WARN("_demo_api is null");
		return;
	}

	auto& name = _demo_api->get_name();

	auto& v = _demo_api->get_version();

	auto pool = _demo_api->get_loop_pool();

	S_INFO("TestApi::Test00, api name = "<<name << ",  get_version = " << v << ", pool.size = " << pool.size() );

	if (pool.size() >= 1) {
		pool[0]->RunInLoop([]() {
			S_INFO("RunInLoop with RxEventApi.get_loop_pool() RunInLoop, *****");
		});
	}

}

void TestApi::Test01()
{
	S_INFO("TestApi::Test01");

	if (!_demo_api) {
		S_WARN("_demo_api is null");
		return;
	}

	auto* lp = _demo_api->get_main_loop_np();

	lp->RunInLoop([]() {
		S_INFO("RunInLoop with RxEventApi.get_main_loop_np() RunInLoop, *****");
	});

	lp->RunAfter(TE::Duration(1.0), []() {

		S_INFO("RunInLoop with RxEventApi RunAfter, *****");

		});



}

